<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/jsp/component/common.jsp" %>
<html>
<head>
    <title>Title</title>
    <script src="../assets/js/views/vue.min.js"></script>
    <script type="text/javascript" src="../assets/js/echarts.js"></script>
    <link rel="stylesheet" href="${frames}/css/lib/bootstrap.min.css" type="text/css" type="text/css">
    <link rel="stylesheet" href="${assets}/css/views/department/addDepartment.scss">

    <script src="${js}/jquery-1.9.1.min.js"></script>
    <%--<link rel="stylesheet" href="${frames}/css/table.css" type="text/css">--%>
    <%--<link rel="stylesheet" href="${frames}/css/qulitity.css" type="text/css" type="text/css">--%>
    <script src="${js}/jquery.dataTables.js"></script>
    <link href="../assets/css/bootstrap-datetimepicker.css" type="text/css">
    <script src="../assets/js/bootstrap-datetimepicker.min.js"></script>
    <%--<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">--%>
    <%--<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">--%>
    <%--<link rel="stylesheet" href="../assets/css/bootstrapDatepickr-1.0.0.css">--%>
    <%--<script src="../assets/js/bootstrapDatepickr-1.0.0.min.js"></script>--%>
    <script src="${frames}/Chronic/laydate/laydate.js"></script>
    <%--<script src="${assets}/js/views/bpAbnormal.js"></script>--%>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.2/css/select2.min.css" rel="stylesheet" />
    <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.2/js/select2.min.js"></script>
    <%--<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.2/js/select2.min.js"></script>--%>
    <style>
        *{
            margin:0;
            padding:0;
        }
        html,body{
            height:100%;
        }
        body{
            width:98%;
        }
        h1{
            font-family: MicrosoftYaHei;
            font-size: 20px;
            font-weight: normal;
            color: #2a3137;
            margin-bottom: 26px;
            float: left;
            margin-top:0 !important
        }
        #main{
            width:470px;
            margin:0 auto;
            overflow:hidden;
            position:relative;
        }
        #main label{
            font-family: MicrosoftYaHei;
            font-size: 18px;
            font-weight: normal;
            font-stretch: normal;
            line-height: 30px;
            letter-spacing: 0px;
            color: #333333;
            width:120px;
            display:inline-block;
        }
        #main div{
            margin-bottom:20px;
        }
        .input{
            width: 260px;
            line-height: 19px;
            border: solid 1px #d0d0d0;
            display:inline-block;
            margin-left:16px;
            font-family: MicrosoftYaHei;
            font-size: 15px;
            font-weight: normal;
            font-stretch: normal;
            color: #999999 !important;
        }
        .bootstrapDatepickr-cal{
            top:250px !important;
        }
        .change{
            width:300px;
            margin:0 auto;
            margin-top:50px;
        }
        .btn{
            width:100px;
            line-height: 15px;
            background: #35acfd;
            color: white;
            margin-top:15px;
        }
        .modal-footer{
            width:255px;
            margin:0 auto;
        }
        #keep{
            background:#35acfd !important;
        }
        /*.bootstrapDatepickr-cal{*/
        /*left:265px !important;*/
        /*}*/
        #beginDate{
            width:100%;
            line-height: 32px;
            border-radius: 5px;
            border: solid 1px #d0d0d0;
            font-size:15px;
            color:#999999 !important
        }
        .date div{
            margin-bottom:0 !important
        }
        .header{
            width:100%;
            overflow:hidden
        }
        #main input{
            text-indent:0.3em
        }
        .defualt{
            border:1px solid red !important;
        }
    </style>
</head>
<body>
<div class="header">
    <h1>修改生命特性</h1>
</div>
<div id="main">
    <div class="temperature">
        <label>体温</label>
        <input id="temperature" type="text"  placeholder="输入体温" class="form-control input" >
    </div>
    <div class="pulse">
        <label>脉搏</label>
        <input id="pulse" type="text"  placeholder="输入脉搏" class="form-control input" >
    </div>
    <div class="breath">
        <label>呼吸</label>
        <input type="text" placeholder="请输入呼吸" id="breath" class="form-control input">
    </div>
    <div class="highestPressure">
        <label>收缩压</label>
        <input id="highestPressure" type="text"  placeholder="输入收缩压" class="form-control input">
    </div>
    <div class="minimumPressure">
        <label>舒张压</label>
        <input id="minimumPressure" type="text"  placeholder="输入舒张压" class="form-control input">
    </div>
    <div>
        <div class="form-group submitBtn" style="text-align: center ">
            <button type="button" class="btn" data-dismiss="modal" id="closeModalButt" @click="closeFrame()">
                关闭
            </button>
            <button type="submit" class="btn" id="keep"  @click="keep()" style="margin-left:20px;">保存</button>
        </div>
    </div>
</div>

<script>
    var vm = new Vue({
        el:"#main",
        data:{
            temperature:'',
            pulse:'',
            breath:'',
            bloodPressure:'',
            minimumPressure:'',
            highestPressure:'',
            id:'',
            idcard:'',
        },
        mounted(){
            //初始化获取数据
            // 获取用药名称
            let that = this;
            var url = decodeURI(decodeURI(location.search))
            var arr = url.split('?')[1]
            var arr1 = arr.split('&');
            console.log(arr1)
            var breath = arr1[3].split('=')[1]
            var temperature = arr1[1].split('=')[1]
            var minimumPressure = arr1[4].split('=')[1]
            var pulse = arr1[2].split('=')[1]
            var id = arr1[0].split('=')[1]
            var highestPressure = arr1[5].split('=')[1];
            $('#breath').val(breath);
            $('#temperature').val(temperature);
            $('#minimumPressure').val(minimumPressure);
            $('#pulse').val(pulse);
            $('#highestPressure').val(highestPressure);
            that.id = id
            /*$.ajax({
                url:"${URL_INDEX_SELECTMEDICALNAME}",
                type:'post',
                data:{
                    acronym:'',
                    medicalName:''
                },
                dataType: "json",
                success:function(data){
                    var arr = [];
                    data.data.forEach((item,index)=>{
                        arr.push({
                            id:item.id,
                        })
                    })
                    that.medicalname = arr;
                    $("#testName").select2({
                        language: 'zh-CN',
                        maximumSelectionLength: 1, //最多能够选择的个数
                        data: that.medicalname
                    })
                }
            })*/
            $.ajax({
                url:"${URL_SCREENING_GETBREADLINE}",
                dataType:'json',
                type:'post',
                success:function(data){
                    that.urlLib = JSON.parse(data.data)
                    that.refreshto = that.urlLib[that.urlLib.length-1].href
                }
            })
            var inputs = $('input')
            for( var a = 0; a < inputs.length; a++ ){
                $(inputs[a]).bind('change',function(){
                    if( $(this).val() != '' ){
                        $(this).removeClass('defualt')
                    }
                })
            }
        },
        methods:{
            closeFrame : function() {
                window.parent.simpleCloseModal();
            },
            keep:function(){
                // 获取当前输入框的所有数据
                // 获取病人id
                let that = this;
                that.temperature = $("#temperature").val();
                that.pulse = $('#pulse').val();
                that.breath = $('#breath').val();
                that.minimumPressure = $('#minimumPressure').val()
                that.highestPressure = $('#highestPressure').val()
                if( that.temperature  && that.pulse != "" && that.breath != '' && that.minimumPressure != '' && that.highestPressure != ''){
                    $.ajax({
                        url:"${URL_PATIENT_UPDATEVITALCHARACTERISTICS}",
                        dataType:"json",
                        type:"post",
                        data:{
                            temperature :that.temperature,
                            pulse:that.pulse,
                            breath:that.breath,
                            minimumPressure:that.minimumPressure,
                            highestPressure:that.highestPressure,
                            id:that.id,
                        },
                        success:function(data){
                            if( data.success ){
                                // 刷新当前页面
                                parent.showSrc(that.refreshto)
                                that.closeFrame()
                            }
                        }
                    })
                }else{
                    var inputs = $('input')
                    var arr = []
                    var arr1 = []
                    if( !that.medicalName ){
                        $('#testName').addClass('defualt')
                        arr1.push($('#testName'))
                    }
                    for( var a = 0; a < inputs.length; a++ ){
                        if( $(inputs[a]).val() === '' ){
                            $(inputs[a]).attr('placeholder','请输入数值')
                            $(inputs[a]).addClass('defualt')
                            arr.push($(inputs[a]))
                        }
                    }
                    if( arr1[0] ){
                        arr1[0].focus()
                        $(arr1[0]).removeClass('defualt')
                    }else{
                        arr[0].focus()
                        $(arr[0]).removeClass('defualt')
                    }
                }
            }
        }
    })

    /*function initLayDate(id) {
        laydate({
            elem: id,
            istime: true,
            format: 'YYYY-MM-DD hh:mm:ss',
            choose: function (dates) { //选择好日期的回调
                // initTablePatient();
            }
        })
    }
    $(document).ready(function() {
        initLayDate('#beginDate');
    });*/
</script>
</body>
</html>

